//
//  pictureViewCell.m
//  Recycling
//
//  Created by jzd on 2018/5/22.
//  Copyright © 2018年 宋佳. All rights reserved.
//

#import "pictureViewCell.h"
#import "orderDetailImageListModel.h"

@interface pictureViewCell ()
@property (weak, nonatomic) IBOutlet UIView *imagesView;
@property (weak, nonatomic) IBOutlet UIImageView *imgOne;
@property (weak, nonatomic) IBOutlet UIImageView *imgTwo;
@property (weak, nonatomic) IBOutlet UIImageView *imgThree;
@property (weak, nonatomic) IBOutlet UIImageView *imgFour;
@property (weak, nonatomic) IBOutlet UIImageView *imgFive;
@property (weak, nonatomic) IBOutlet UIImageView *imgSix;



@end
@implementation pictureViewCell

-(void)awakeFromNib{
    [super awakeFromNib];
    
    for (UIImageView *imageV in self.imagesView.subviews) {
        imageV.userInteractionEnabled = YES;
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(imageOnClick:)];
        [imageV addGestureRecognizer:tap];
    }
}

-(void)setImages:(NSArray *)images{
    _images = images;
    NSArray *arr = @[self.imgOne,self.imgTwo,self.imgThree,self.imgFour,self.imgFive,self.imgSix];
    if (images.count!=0) {
        for (int i = 0; i<images.count; i++) {
            if (i>=6) {
                return;
            }else{
                orderDetailImageListModel *mode = (orderDetailImageListModel *)[images objectAtIndex:i];
                UIImageView *imageV  = [arr objectAtIndex:i];
                [imageV sd_setImageWithURL:[NSURL URLWithString:mode.ImgUrl] placeholderImage:[UIImage imageNamed:@"pic_holder"]];
                
            }
        }
    }else{
        self.imagesView.hidden = YES;
    }
}
- (IBAction)imageOnClick:(UITapGestureRecognizer *)sender {
    if ([self.delegate respondsToSelector:@selector(pictureViewCell:pictureOnClick:)]) {
        [self.delegate pictureViewCell:self pictureOnClick:sender.view.tag-200];
    }
}
@end
